#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int N;
//	cin >> N;
	scanf("%d",&N);
	vector<int> res;

	for (int a = 0; a <= sqrt(N); a++) {
		for (int b = a; b <= sqrt(N); b++) {
			for (int c = b; c <= sqrt(N); c++) {
				for (int d = c; d <= sqrt(N); d++) {
					if (a * a + b * b + c * c + d * d == N) {
						res.push_back(a);
						res.push_back(b);
						res.push_back(c);
						res.push_back(d);
						goto end;
					}
				}
			}
		}
	}

end:
//	sort(res.begin(), res.end());

	for (int i = 0; i < res.size(); i++) {
//		cout << res[i] << " ";
		printf("%d ",res[i]);
	}

	return 0;
}
